import json
from src.common.logger import getLogger
from flask import Blueprint, Response, request
from src.modules.rag.service import arxiv_service

logger = getLogger()
api = Blueprint("arxiv", __name__)

@api.route("/arxiv/retrieve", methods=['POST'])
def retrieval_arxiv():
    form = request.form
    logger.info(f"retrieval_arxiv form: {form}")
    retrieve_docs = arxiv_service.invoke_retrieval_arxiv(form)
    return Response(json.dumps({ "code": 200, "data": retrieve_docs }), status = 200, mimetype = "application/json")
